package com.bw.controller;


import com.bw.bean.Vo;
import com.bw.bean.Vo1;
import com.bw.service.VoService;
import com.sugar.SugarUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@RestController
public class VoController {

    @Autowired
    VoService voService;


    @RequestMapping("list1")
    public Map  getList1(){
        List<Vo> list = voService.getList1();
        return SugarUtil.getLineData(list);
    }


    @RequestMapping("list2")
    public Map  getList2(){
        List<Vo1> list = voService.getList2();
        List list1 = new ArrayList();
        list1.add("来源名称");
        list1.add("订单总额");
        list1.add("用户总数");
        list1.add("订单总数");
        return SugarUtil.getTablePlayData(list1,list);
    }



    @RequestMapping("list3")
    public Map  getList3(){
        Double val = voService.getList3();
        return SugarUtil.getFlipNumberData(val);
    }


    @RequestMapping("list4")
    public Map  getList4(){
        List<Vo> list = voService.getList4();
        List list1 = new ArrayList();
        list1.add("课程名称");
        list1.add("订单金额");
        return SugarUtil.getTablePlayData(list1,list);
    }

}
